package com.barry;

/**
 * 类功能描述：//TODO
 *
 * @author WangXueXing create at 19-3-31 下午12:29
 * @version 1.0.0
 */
public class ArrayCopyTest {
    public static void main(String[] args){
       /* String[] srcArray = new String[]{"sds","35435","4ree"};
        String[] tarArray = new String[2];
        System.arraycopy(srcArray, 1, tarArray, 0, 2);
        for(String meta: tarArray){
            System.out.println(meta);
        }*/

        byte[] s= "dsfskjnk\n223".getBytes();
        int firstLineIndex = indexOf(s, 0);
        int newByteLenth = s.length-firstLineIndex-1;
        byte[] newStrByte = new byte[newByteLenth];
        System.arraycopy(s, firstLineIndex+1, newStrByte, 0, newByteLenth);
        System.out.println(new String(newStrByte));
    }

    private static int indexOf(byte[] src, int fromIndex){
        for (int i = fromIndex; i < src.length; i++) {
            if (src[i] == "\n".getBytes()[0]) {
                return i;
            }
        }
        return -1;
    }
}
